package rhc.taskSchedule.taskDistribute;

import rhc.taskSchedule.entity.Running;
import rhc.taskSchedule.entity.RunningStartType;
import rhc.taskSchedule.entity.RunningStatus;
import rhc.taskSchedule.entity.RunningType;

/**任务分发接口，包括调度任务和执行任务
 * @author rhc
 *
 */
public interface TaskDistribute {
	
	/**创建一个运行记录
	 * @param sourceId
	 * @param runningType
	 * @param runningStartType
	 * @return
	 * @throws Exception
	 */
	Running createRunning(String sourceId,RunningType runningType,RunningStartType runningStartType) throws Exception;
	
	/**开始一个运行任务
	 * @param runningId
	 * @throws Exception
	 */
	void startRunning(String runningId) throws Exception;
	
	/**暂停一个运行任务
	 * @param runningId
	 * @throws Exception
	 */
	void pauseRunning(String runningId) throws Exception;
	
	/**恢复一个运行任务
	 * @param runningId
	 * @throws Exception
	 */
	void regainRunning(String runningId) throws Exception;
	
	/**停止一个运行任务
	 * @param runningId
	 * @throws Exception
	 */
	void stopRunning(String runningId) throws Exception;
	
	/**获取一个运行任务运行状态
	 * @param runningId
	 * @return
	 * @throws Exception
	 */
	RunningStatus getRunningStatus(String runningId) throws Exception;
	
	/**根据runningId获取running
	 * @param runningId
	 * @return
	 * @throws Exception
	 */
	Running getRunning(String runningId) throws Exception;
	
}
